<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBusinessesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('businesses', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique()->nullable(false);
            $table->string('description')->nullable();
            $table->boolean('is_statistical')->default(false);  //是否为统计项目
            $table->boolean('is_enable')->default(true);        //业务是否可用
            $table->integer('order')->unsigned()->default(0);
            $table->integer('category_id')->default(0);         //表示项目无分类
            $table->string('unit')->nullable();                       //业务单位，例如:存款（万）,对公开户（户）等
            $table->integer('parent_id')->unsigned()->nullable();
            $table->string('data_cycle');                             //数据周期即评价周期，例如:月/季/半年/年
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('businesses');
    }
}
